Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue688: Make maxParamByteSize configurable in ParamFlowRequestDataWriter of cluster client module #823

Merged
merged 9 commits into from
Jun 13, 2019
Merged

Conversation

linlinisme
Copy link
Collaborator

Describe what this PR does / why we need it

Does this pull request fix one issue?

fix: #688

Describe how you did it

1、maxParamByteSize take effect :
when serialize parameters, use the return value of
calculateParamAmount() as the numbers that parameters can be written.

2、make the maxParamByteSize configurable:
add property: csp.sentinel.cluster.max.param.byte.size in SentinelConfig class
in DefaultClusterClientInitFunc class, when invoke initDefaultEntityWriters() method, read from Sentinel to get the property

Describe how to verify it

run in cluster model,and configure the csp.sentinel.cluster.max.param.byte.size. Observe whether the configuration takes effect。and i add some log when the params size over head the configure size.

@sczyh30 sczyh30 added the to-review To review label Jun 11, 2019
@sczyh30 sczyh30 added the area/cluster-flow Issues or PRs related to cluster flow control label Jun 11, 2019
@codecov-io
Copy link

codecov-io commented Jun 12, 2019

Codecov Report

Merging #823 into master will decrease coverage by 0.07%.
The diff coverage is 47.5%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #823      +/-   ##
============================================
- Coverage     41.75%   41.67%   -0.08%     
+ Complexity     1377     1375       -2     
============================================
  Files           304      305       +1     
  Lines          8764     8775      +11     
  Branches       1182     1184       +2     
============================================
- Hits           3659     3657       -2     
- Misses         4660     4672      +12     
- Partials        445      446       +1
Impacted Files Coverage Δ Complexity Δ
...om/alibaba/csp/sentinel/config/SentinelConfig.java 51.61% <ø> (ø) 14 <0> (ø) ⬇️
...ster/client/config/ClusterClientStartUpConfig.java 0% <0%> (ø) 0 <0> (?)
...ster/client/init/DefaultClusterClientInitFunc.java 0% <0%> (ø) 0 <0> (ø) ⬇️
...a/com/alibaba/csp/sentinel/node/StatisticNode.java 55.68% <100%> (ø) 27 <0> (ø) ⬇️
.../client/codec/data/ParamFlowRequestDataWriter.java 37.5% <59.25%> (+0.32%) 13 <4> (-1) ⬇️
...a/csp/sentinel/slots/statistic/base/LeapArray.java 67.32% <0%> (-2.98%) 33% <0%> (-1%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e3b9f99...e32e9a4. Read the comment docs.

@linlinisme
Copy link
Collaborator Author

I add ClusterSentinelConfig class which dedicated to reading startup configurations of cluster client

* @author lianglin
* @since 1.7.0
*/
public class ClusterSentinelConfig {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name ClusterSentinelConfig might be confusing... How about ClusterClientStartupConfig or other else better?

for (Object param : entity.getParams()) {
encodeValue(param, target);
Object[] array = params.toArray();
for (int index = 0; index < amount; index++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some problems. Assume the parameter type list is [double, float, SomePojo, int], the customized SomePojo object will be ignored so the calculated amount will be 3. Then if we use [0..2] as the index to encode values, the third int value would be lost. Maybe we need a List<Object> resolveValidParams(Collection<Object> params) method (could be refactored from calculateParamTransportSize method) , then we could get the amount and all values in order from the method.

@sczyh30
Copy link
Member

sczyh30 commented Jun 12, 2019

And could you please update the test cases in ParamFlowRequestDataWriterTest?

@linlinisme
Copy link
Collaborator Author

emm, good suggestion.

@linlinisme
Copy link
Collaborator Author

I lack some considerations....

@linlinisme
Copy link
Collaborator Author

the latest code had commit

Copy link
Member

@sczyh30 sczyh30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sczyh30 sczyh30 merged commit e6e27c6 into alibaba:master Jun 13, 2019
@sczyh30
Copy link
Member

sczyh30 commented Jun 13, 2019

Nice work, thanks for contributing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cluster-flow Issues or PRs related to cluster flow control
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make maxParamByteSize configurable in ParamFlowRequestDataWriter of cluster client module
3 participants